#ifndef I2C_BASE_H
#define I2C_BASE_H

#undef EXT
#ifdef  I2C_BASE_C
#define EXT
#else
#define EXT extern
#endif

#define DIR_OUTPUT  0
#define DIR_INPUT   1

typedef struct
{
  OS_ALIGN_TYPE Head;
  jmp_buf Env;
  OS_ALIGN_TYPE Tail;
}S_Jmp_Env;

#define I2C_DS3231_ID 0
#define I2C_RX8025_ID 1
#define I2C_RX8025T_ID 2

EXT void I2C_Init(void);
EXT void I2C_Open(INT8U Id);
EXT void I2C_Close(INT8U Id);

EXT INT8U I2C_Start(INT8U Id);
EXT INT8U I2C_Stop(INT8U Id) ;
EXT INT8U I2C_Send_N_Ack(INT8U Id,INT8U Ack_Nack);
EXT INT8U I2C_Send_Byte(INT8U Id,INT8U sbyte);
EXT INT8U I2C_Read_Byte(INT8U Id,INT8U *Dst);
EXT INT8U I2C_Read_nByteS(INT8U Id,INT16U Len,INT8U *Dst);
EXT void I2C_Reset(INT8U Id);
EXT INT8U I2C_EnWp(INT8U Id,INT8U Wp);
#endif